<template>
<div class="rw-div">
      <div :style="{'marginRight' : (index + 1) / 4 === 1 ? '0px' : '3%'}" :class="active === index ? 'dateItems' : 'dateItem' " v-for="(item, index) in rwDateArr" v-bind:key="index" @click="checkDate(item, index)">
        <van-row class="line-div">
          <van-col span="24">{{item.label}}</van-col>
        </van-row>
        <van-row :class="active === index ? 'line-div-text1s' : 'line-div-text1' " class="line-div">
          <van-col span="24">{{item.day}}</van-col>
        </van-row>
        <van-row :class="active === index ? 'line-div1s' : 'line-div1' ">
          <van-col span="24">{{item.dayNumber}}待服务</van-col>
        </van-row>
      </div>
  </div>
</template>
<script>
export default {
  name: 'rw-calendar',
  data () {
    return {
      active: 0
    }
  },
  props: {
    rwDateArr: {
      type: Array,
      default: function () {
        return []
      }
    }
  },
  methods: {
    checkDate (item, index) {
      this.active = index
      this.$emit('getCheckDate', item.date)
    }
  },
  mounted () {
    console.log(this.rwDateArr, '#####')
  }
}
</script>
<style scoped lang="less">
  .rw-div {
    background-color: #fff;
    // width: 86%;
    height: 169px;
    top: 10px;
    // margin-left: 5%;
    position: relative;
    border-radius: 5px;
    padding: 5px 2%;
    .dateItem {
      display: inline-block;
      background-color: #f8f8f8;
      height: 68px;
      width: 21.5%;
      // margin-right: 10px;;
      border-radius: 6px;
      margin-bottom: 5px;
      text-align: center;
      padding: 5px 0.5%;
    }
    .dateItems {
      display: inline-block;
      background-color: #f8f8f8;
      height: 68px;
      width: 21.5%;
      // margin-right: 10px;;
      border-radius: 6px;
      border: 1px solid #ff7a50;
      color: #fd4834;
      margin-bottom: 5px;
      text-align: center;
      padding: 5px 0.5%;
    }
    .mr3 {
      margin-right: 3%;
    }
    .mr0 {
      margin-right: 0%;
    }
    .line-div {
      height: 17px;
      margin-bottom: 8px;
    }
    .line-div-text {
      color: #666;
      font-size: 12px;
    }
    .line-div-text1 {
      color: #232323;
      font-weight: 700;
      font-size: 15px;
    }
    .line-div-text1s {
      color: #fd4834;
      font-weight: 700;
      font-size: 15px;
    }
    .line-div1 {
      background-color: #ffffff;
      height: 20px;
      line-height: 20px;
      text-align: center;
      color: #cfcfcf;
      font-size: 8px;
      border-radius: 2px;
    }
    .line-div1s {
      background-color: #fd4834;
      height: 20px;
      line-height: 20px;
      text-align: center;
      color: #fff;
      font-size: 8px;
      border-radius: 2px;
    }
    .day-div {
      width: 51px;
      height: 66px;
      background-color: #f8f8f8;
      border-radius: 5px;
    }
    .van-grid-item {
      height: 78px;
    }
    /deep/ .van-grid-item__content--center {
      background-color: #f8f8f8;
    }
    /deep/ .van-grid-item__content {
      padding: 5px 5px;
    }
    .sel1[data-v-792606a9] {
      border: 1px solid #ff7a50;
      color: #fd4834;
    }
  }
</style>
